﻿// ....................................................................................................................
//	Author: Copyright (C) 2012 Ing. Marek Hubal
//	Email: hubal@acasoftware.org
// ....................................................................................................................

using System;

namespace core
{
    /// <summary>Trieda ISearchInContentStream</summary>
    public class ISearchInContentStream : IDisposable
    {
        public delegate int EventGetData(byte[] pBuffer, int pStart, int pMaxLength);

        public event EventGetData GetData;

        public const int FIND_YES = 0;
        public const int FIND_NO = 1;
        public const int FIND_NEED_MORE_DATA = 2;

        public int BufferSize; // Velkost bufra
        public byte[] InternalBuffer; // Interny buffer

        protected int FCompareMode;
        protected byte[] FRawSearchValue;
        protected int FCurrentItemIndex;
        protected int FCurrentPeekItemIndex;
        protected int FCurrentLength;

        protected byte[] FTextSearchValue_LowerCase;
        protected byte[] FTextSearchValue_UpperCase;
        protected int[] FTextSearchValue_LowerCase_BytesPerCharCount;
        protected int[] FTextSearchValue_UpperCase_BytesPerCharCount;
        protected IFileExplorer_ProgressForm_Search FProgressForm;        


        /// <summary>Ziskanie byte</summary>
        /// <param name="Result">vysledok</param>
        /// <returns>true / false</returns>
        protected bool GetByte(out byte Result)
        {
            if (FCurrentItemIndex >= FCurrentLength) // Koniec bufra?
            {
                Result = 0;
                if ((FProgressForm != null) && (FProgressForm.CanCancelSearch)) return false;
                if (GetData == null) return false; // Neviem citat?
                FCurrentLength = GetData(InternalBuffer, 0, InternalBuffer.Length); // Nacitam
                if (FCurrentLength == 0) return false; // Uz nie su data?
                FCurrentItemIndex = 0;
            }
            Result = InternalBuffer[FCurrentItemIndex++]; // Vratim byte
            FCurrentPeekItemIndex = FCurrentItemIndex;
            return true;
        }
        /// <summary>Test byte</summary>
        /// <param name="Result">vysledok</param>
        /// <returns>true / false</returns>
        protected bool PeekByte(out byte Result)
        {
            if (FCurrentPeekItemIndex >= FCurrentLength) // Koniec bufra?
            {
                Result = 0;
                if ((FProgressForm != null) && (FProgressForm.CanCancelSearch)) return false;
                int C = FCurrentLength - FCurrentItemIndex; // Presuniem zvysok na zaciatok bufra
                for (int i = 0; i < C; i++) InternalBuffer[i] = InternalBuffer[i + FCurrentItemIndex];
                FCurrentPeekItemIndex -= FCurrentItemIndex;
                if (GetData == null) return false; // Neviem citat?
                FCurrentLength = GetData(InternalBuffer, FCurrentPeekItemIndex, InternalBuffer.Length - FCurrentPeekItemIndex); // Nacitam
                if (FCurrentLength == 0) return false; // Uz nie su data?
                FCurrentItemIndex = 0;
            }
            Result = InternalBuffer[FCurrentPeekItemIndex++]; // Vratim byte
            return true;
        }
        /// <summary>Ziskanie bajtov</summary>
        /// <param name="pLength">pocet</param>
        /// <param name="Result">vysledok</param>
        /// <returns>true / false</returns>
        protected bool GetBytes(int pLength, byte[] Result)
        {
            for (int i = 0; i < pLength; i++)
            {
                if (!GetByte(out Result[i])) return false; // Nacitam byte po byte
            }
            return true; // OK
        }
        /// <summary>Test bajtov</summary>
        /// <param name="pLength">dlzka</param>
        /// <param name="Result">vysledok</param>
        /// <returns>true / false</returns>
        protected bool PeekBytes(int pLength, byte[] Result)
        {
            for (int i = 0; i < pLength; i++)
            {
                if (!PeekByte(out Result[i])) return false; // Nacitam byte po byte
            }
            return true; // OK
        }

        /// <summary>Test ci pole bajtov je zhodne s jednym so zadanych</summary>
        /// <param name="pLength">dlzka</param>
        /// <param name="pSource">zdroj</param>
        /// <param name="pStart1">zaciatok pola 1</param>
        /// <param name="pValue1">testovane pole 1</param>
        /// <param name="pStart2">zaciatok pola 2</param>
        /// <param name="pValue2">testovane pole 2</param>
        /// <returns>true / false</returns>
        protected bool IsOne(int pLength, byte[] pSource, int pStart1, byte[] pValue1, int pStart2, byte[] pValue2)
        {
            int I = 0x3;
            for (int i = 0; i < pLength; i++)
            {
                if ((I & 0x1) != 0) // Testovat prvu hodnotu
                {
                    if (pSource[i] != pValue1[i + pStart1])
                    {
                        I &= ~0x1;
                        if (I == 0) return false;
                    }
                }
                if ((I & 0x2) != 0) // Testovat druhu hodnotu
                {
                    if (pSource[i] != pValue2[i + pStart2])
                    {
                        I &= ~0x2;
                        if (I == 0) return false;
                    }
                }
            }
            return true; // Zhoda aspon z jednym
        }

        /// <summary>Konstruktor</summary>
        /// <param name="pBufferSize">velkost internej pamate</param>
        public ISearchInContentStream(int pBufferSize = 128*1024)
        {
            InternalBuffer = new byte[pBufferSize];
            BufferSize = pBufferSize;
            GetData = null;
        }
        /// <summary>Dispose metoda</summary>
        public void Dispose()
        {
        }

        /// <summary>Inicializacia</summary>
        /// <param name="pSearchValue">hladana hodnota</param>
        /// <param name="pCaseSensitive">priznak case sensitivnosti</param>
        /// <param name="pEncodingType">typ kodovania</param>
        public void Init(string pSearchValue, bool pCaseSensitive, int pEncodingType)
        {
            switch (pEncodingType)
            {
                case 0:
                    {
                        if (pCaseSensitive)
                        {
                            FRawSearchValue = System.Text.Encoding.Default.GetBytes(pSearchValue);
                            FCompareMode = 0;
                        }
                        else
                        {
                            FTextSearchValue_LowerCase_BytesPerCharCount = new int[pSearchValue.Length];
                            FTextSearchValue_UpperCase_BytesPerCharCount = new int[pSearchValue.Length];

                            string UpperCase = pSearchValue.ToUpper();
                            for (int i = 0; i < UpperCase.Length; i++)
                            {
                                FTextSearchValue_UpperCase_BytesPerCharCount[i] = System.Text.Encoding.Default.GetByteCount(UpperCase.Substring(i, 1));
                            }
                            string LowerCase = pSearchValue.ToLower();
                            bool Same = true;
                            for (int i = 0; i < LowerCase.Length; i++)
                            {
                                FTextSearchValue_LowerCase_BytesPerCharCount[i] = System.Text.Encoding.Default.GetByteCount(LowerCase.Substring(i, 1));
                                if (FTextSearchValue_LowerCase_BytesPerCharCount[i] != FTextSearchValue_UpperCase_BytesPerCharCount[i]) Same = false;
                            }

                            if (!Same)
                            {
                                FRawSearchValue = System.Text.Encoding.Default.GetBytes(pSearchValue);
                                FCompareMode = 0;
                            }
                            else
                            {
                                FTextSearchValue_LowerCase = System.Text.Encoding.Default.GetBytes(LowerCase);
                                FTextSearchValue_UpperCase = System.Text.Encoding.Default.GetBytes(UpperCase);
                                FCompareMode = 1;
                            }
                        }
                    } break;
                case 1:
                    {
                        if (pCaseSensitive)
                        {
                            FRawSearchValue = System.Text.Encoding.UTF8.GetBytes(pSearchValue);
                            FCompareMode = 0;
                        }
                        else
                        {
                            FTextSearchValue_LowerCase_BytesPerCharCount = new int[pSearchValue.Length];
                            FTextSearchValue_UpperCase_BytesPerCharCount = new int[pSearchValue.Length];

                            string UpperCase = pSearchValue.ToUpper();
                            for (int i = 0; i < UpperCase.Length; i++)
                            {
                                FTextSearchValue_UpperCase_BytesPerCharCount[i] = System.Text.Encoding.UTF8.GetByteCount(UpperCase.Substring(i, 1));
                            }
                            string LowerCase = pSearchValue.ToLower();
                            bool Same = true;
                            for (int i = 0; i < LowerCase.Length; i++)
                            {
                                FTextSearchValue_LowerCase_BytesPerCharCount[i] = System.Text.Encoding.UTF8.GetByteCount(LowerCase.Substring(i, 1));
                                if (FTextSearchValue_LowerCase_BytesPerCharCount[i] != FTextSearchValue_UpperCase_BytesPerCharCount[i]) Same = false;
                            }

                            if (!Same)
                            {
                                FRawSearchValue = System.Text.Encoding.Default.GetBytes(pSearchValue);
                                FCompareMode = 0;
                            }
                            else
                            {
                                FTextSearchValue_LowerCase = System.Text.Encoding.UTF8.GetBytes(LowerCase);
                                FTextSearchValue_UpperCase = System.Text.Encoding.UTF8.GetBytes(UpperCase);
                                FCompareMode = 2;
                            }
                        }
                    } break;
                case 2:
                    {
                        if (pCaseSensitive)
                        {
                            FRawSearchValue = System.Text.Encoding.Unicode.GetBytes(pSearchValue);
                            FCompareMode = 0;
                        }
                        else
                        {
                            FTextSearchValue_LowerCase_BytesPerCharCount = new int[pSearchValue.Length];
                            FTextSearchValue_UpperCase_BytesPerCharCount = new int[pSearchValue.Length];

                            string UpperCase = pSearchValue.ToUpper();
                            for (int i = 0; i < UpperCase.Length; i++)
                            {
                                FTextSearchValue_UpperCase_BytesPerCharCount[i] = System.Text.Encoding.Unicode.GetByteCount(UpperCase.Substring(i, 1));
                            }
                            string LowerCase = pSearchValue.ToLower();
                            bool Same = true;
                            for (int i = 0; i < LowerCase.Length; i++)
                            {
                                FTextSearchValue_LowerCase_BytesPerCharCount[i] = System.Text.Encoding.Unicode.GetByteCount(LowerCase.Substring(i, 1));
                                if (FTextSearchValue_LowerCase_BytesPerCharCount[i] != FTextSearchValue_UpperCase_BytesPerCharCount[i]) Same = false;
                            }

                            if (!Same)
                            {
                                FRawSearchValue = System.Text.Encoding.Default.GetBytes(pSearchValue);
                                FCompareMode = 0;
                            }
                            else
                            {
                                FTextSearchValue_LowerCase = System.Text.Encoding.Unicode.GetBytes(LowerCase);
                                FTextSearchValue_UpperCase = System.Text.Encoding.Unicode.GetBytes(UpperCase);
                                FCompareMode = 3;
                            }
                        }
                    } break;
                default: // HEX mod
                    {
                        string[] S = pSearchValue.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // Prevediem HEX data na byte hodnoty
                        FRawSearchValue = new byte[S.Length]; // Alokujem pamat
                        for (int i = 0; i < S.Length; i++)
                        {
                            try
                            {
                                FRawSearchValue[i] = (byte)Convert.ToInt32(S[i], 16);
                            }
                            catch
                            {
                                FRawSearchValue[i] = 0;
                            }
                        }
                        FCompareMode = 0;
                    } break;
            }

            Reset(); // Reset
        }
        /// <summary>Vynulovanie</summary>
        public void Reset()
        {
            FCurrentItemIndex = FCurrentLength = FCurrentPeekItemIndex = 0;
        }

        /// <summary>Hladanie v mode 0</summary>
        /// <param name="pBreak">priznak prerusenia</param>
        /// <returns>vysledok</returns>
        public int Find_Mode_0(IFileExplorer_ProgressForm_Search pProgressForm)
        {
            byte B;
            while (true)
            {
                if (!GetByte(out B)) return FIND_NO;
                if (B != FRawSearchValue[0]) continue;
                int i;
                for (i = 1; i < FRawSearchValue.Length; i++)
                {
                    if (!PeekByte(out B)) return FIND_NO;
                    if (B != FRawSearchValue[i]) break;
                }
                if (i == FRawSearchValue.Length) return FIND_YES;
            }
        }
        /// <summary>Hladanie v mode 1</summary>
        /// <param name="pBreak">priznak prerusenia</param>
        /// <returns>vysledok</returns>
        public int Find_Mode_1(IFileExplorer_ProgressForm_Search pProgressForm)
        {
            byte[] B = new byte[32];
            byte B1;

            while (true)
            {
                int i; int Pos = 0;
                for (i = 0; i < FTextSearchValue_LowerCase_BytesPerCharCount.Length; i++)
                {
                    if (!PeekBytes(FTextSearchValue_LowerCase_BytesPerCharCount[i], B)) return FIND_NO;
                    if (!IsOne(FTextSearchValue_LowerCase_BytesPerCharCount[i], B, Pos, FTextSearchValue_LowerCase, Pos, FTextSearchValue_UpperCase)) break;
                    Pos += FTextSearchValue_LowerCase_BytesPerCharCount[i];
                }
                if (i == FTextSearchValue_LowerCase_BytesPerCharCount.Length) return FIND_YES;
                if (!GetByte(out B1)) return FIND_NO;
            }
        }

        /// <summary>Hladanie vyskytu</summary>
        /// <returns>vysledok operacie</returns>
        public int Find(IFileExplorer_ProgressForm_Search pProgressForm)
        {
            FProgressForm = pProgressForm;
            switch (FCompareMode)
            {
                case 1:
                case 2:
                case 3:
                    return Find_Mode_1(pProgressForm);
                default: return Find_Mode_0(pProgressForm);
            }
        }
    }

    /// <summary>Trieda ISearchDataStruct</summary>
    public class ISearchDataStruct
    {
        public System.Collections.Generic.List<string> SearchPaths;
        public string SearchNameValue;
        public bool SearchPartialName;
        public bool SearchInArchive;
        public int SearchMaxDepth;
        public INodeFilters SearchExtFilter;
        public bool SearchInContent;
        public string SearchContentValue;
        public bool SearchInContent_CaseSensitive;
        public bool SearchInContent_NotInContent;
        public int SearchInContent_EncodingType;

        /// <summary>Konstruktor</summary>
        public ISearchDataStruct()
        {
            SearchPaths = new System.Collections.Generic.List<string>();
            SearchExtFilter = new INodeFilters();
            Init();
        }

        /// <summary>Inicializacia</summary>
        public void Init()
        {
            SearchPaths.Clear();
            SearchNameValue = "";
            SearchPartialName = false;
            SearchInArchive = false;
            SearchExtFilter.Clear();
        }
        /// <summary>Serializacia obsahu</summary>
        /// <returns>serializovany obsah</returns>
        public string Serialize()
        {
            using (IParamList L = new IParamList())
            {
                L.SetParam("NV", SearchNameValue);
                L.SetParam("PN", SearchPartialName);
                L.SetParam("IA", SearchInArchive);
                L.SetParam("MD", SearchMaxDepth);
                L.SetParam("EF", SearchExtFilter.Serialize());
                L.SetParam("IC", SearchInContent);
                L.SetParam("CV", SearchContentValue);
                L.SetParam("IC_CS", SearchInContent_CaseSensitive);
                L.SetParam("IC_NIC", SearchInContent_NotInContent);
                L.SetParam("IC_ET", SearchInContent_EncodingType);
                return L.Serialize(true);
            }
        }
        public void Deserialize(string pData)
        {
            using (IParamList L = new IParamList())
            {
                L.Deserialize(pData, true);
                SearchNameValue = L.GetParam("NV", SearchNameValue);
                SearchPartialName = L.GetParam("PN", SearchPartialName);
                SearchInArchive = L.GetParam("IA", SearchInArchive);
                SearchMaxDepth = L.GetParam("MD", SearchMaxDepth);
                L.GetParam("EF", SearchExtFilter.Serialize());
                SearchInContent = L.GetParam("IC", SearchInContent);
                SearchContentValue = L.GetParam("CV", SearchContentValue);
                SearchInContent_CaseSensitive = L.GetParam("IC_CS", SearchInContent_CaseSensitive);
                SearchInContent_NotInContent = L.GetParam("IC_NIC", SearchInContent_NotInContent);
                SearchInContent_EncodingType = L.GetParam("IC_ET", SearchInContent_EncodingType);
            }
        }

        /// <summary>Test ci je zadana hodnota pripustnym HEX retazcom hladania</summary>
        /// <param name="pValue">testovana hodnota</param>
        /// <returns>true / false</returns>
        public static bool IsValidHEXSearchString(string pValue)
        {
            try
            {
                if (string.IsNullOrEmpty(pValue)) return true; // Prazdny vstup?

                string[] S = pValue.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // Rozdelim
                foreach(string S1 in S) 
                {
                    if (S1.Length != 2) return false; // Nema dva znaky?
                    Convert.ToInt32(S1, 16); // Pokus o prevod
                }
                return true; // OK hodnota
            }
            catch
            {
                return false; // Chybna hodnota
            }
        }
    }

    /// <summary>Trieda IFileExplorer_ProgressForm_Search</summary>
    public class IFileExplorer_ProgressForm_Search : IFileExplorer_BaseProgressForm
    {
        public delegate void Delegate_StopSearch();
        public delegate void Delegate_UpdateProgress(bool pForce);
        public delegate void Delegate_AddResult(string pName, long pLength, bool pDirectory, uint pAttr, DateTime pDModify, bool pIsArchiveItem, int pOriginalID);

        protected IGroupBox FGrp;
        protected IButton FBtn_Cancel;
        protected IButton FBtn_Search;
        protected IButton FBtn_View;
        protected IButton FBtn_FeedToList;
        
        protected ILabel FLabel1;
        protected ITextBox FText_SearchPath;
        protected IButton FBtn_MoreSearchPath;
        protected System.Windows.Forms.ContextMenuStrip FMenu_MoreSearchPath;
        protected ILabel FLabel2;
        protected ITextBox FText_SearchName;
        protected IButton FBtn_Filter;
        protected ICheckBox FCheck_SearchPartialName;
        protected ICheckBox FCheck_SearchInArchives;
        protected IComboBox FCombo_SubdirSearch;
        protected IHorizontalSplitLine FLine1;
        protected ICheckBox FCheck_SearchInContent;
        protected ITextBox FText_SearchContentValue;
        protected ICheckBox FCheck_CaseSensitive;
        protected ICheckBox FCheck_HEXData;
        protected IComboBox FCombo_ContentEncoding;
        protected ICheckBox FCheck_NotInContent;
        protected IHorizontalSplitLine FLine2;
        protected IListView FResultList;
        protected ILabel FStatus;

        protected string FCurrentPath; // Aktualna cesta panela
        protected string FOppositeCurrentPath; // Aktualna cesta druheho panela

        public IThrSafeVariable WaitForTerminate;
        public ISearchDataStruct SearchData;
        public IThrSafeVariable RunState;
        public string SingleChoosedItem; // Vybrana najdena polozka

        protected System.Diagnostics.Stopwatch FUpdateWatch;
        protected string FCurrentItemName; // Aktualny zaznam
        protected int FResultFilesCount; // Pocet najdenych suborov
        protected int FResultDirsCount; // Pocet najdenych priecinkov
        protected int FScannedCount; // Pocet skenovanych
        protected INodeFilters ExtFilter; // Filter pre rozsirene hladanie
        protected int FCanCancelSearchCounter; // Pocitadlo pristupov ku property CanCancelSearch
        protected int FArchiveItemsCount; // Pocet poloziek najdenych v archivoch
        public INodeList_VirtualItems VirtualList; // Virtualny zoznam

        /// <summary>Serializacia obsahu</summary>
        /// <returns>serializovany obsah</returns>
        public string SerializeFormContent()
        {
            using (IParamList L = new IParamList())
            {
                L.SetParam("SN", FText_SearchName.Text);
                L.SetParam("SPN", FCheck_SearchPartialName.Checked);
                L.SetParam("SIA", FCheck_SearchInArchives.Checked);
                L.SetParam("SS", FCombo_SubdirSearch.SelectedIntID);
                L.SetParam("SIC", FCheck_SearchInContent.Checked);
                L.SetParam("SCV", FText_SearchContentValue.Text);
                L.SetParam("CA", FCheck_CaseSensitive.Checked);
                L.SetParam("HD", FCheck_HEXData.Checked);
                L.SetParam("CE", FCombo_ContentEncoding.SelectedIntID);
                L.SetParam("NIC", FCheck_NotInContent.Checked);
                L.SetParam("F", ExtFilter.Serialize());
                return L.Serialize(true);
            }
        }
        /// <summary>Deserializacia obsahu</summary>
        /// <param name="pData">data</param>
        public void DeserializeFormContent(string pData)
        {
            using (IParamList L = new IParamList())
            {
                L.Deserialize(pData, true);
                FText_SearchName.Text = L.GetParam("SN", FText_SearchName.Text);
                FCheck_SearchPartialName.Checked = L.GetParam("SPN", FCheck_SearchPartialName.Checked);
                FCheck_SearchInArchives.Checked = L.GetParam("SIA", FCheck_SearchInArchives.Checked);
                FCombo_SubdirSearch.SelectedIntID = L.GetParam("SS", FCombo_SubdirSearch.SelectedIntID);
                FCheck_SearchInContent.Checked = L.GetParam("SIC", FCheck_SearchInContent.Checked);
                FText_SearchContentValue.Text = L.GetParam("SCV", FText_SearchContentValue.Text);
                FCheck_CaseSensitive.Checked = L.GetParam("CA", FCheck_CaseSensitive.Checked);
                FCheck_HEXData.Checked = L.GetParam("HD", FCheck_HEXData.Checked);
                FCombo_ContentEncoding.SelectedIntID = L.GetParam("CE", FCombo_ContentEncoding.SelectedIntID);
                FCheck_NotInContent.Checked = L.GetParam("NIC", FCheck_NotInContent.Checked);
                ExtFilter.Deserialize(L.GetParam("F", ""));
            }
        }

        /// <summary>Property: CanCancelSearch</summary>
        public bool CanCancelSearch
        {
            get
            {
                if (++FCanCancelSearchCounter < 0) return false; // Obmedzenie prilis casteho pristupu ku safe thread premennym
                FCanCancelSearchCounter = 0;

                if (WaitForTerminate.BoolValue) return true;
                if (RunState.IntValue == 2) return true;
                return false;
            }
        }

        /// <summary>Konstruktor</summary>
        /// <param name="pWidth">sirka</param>
        /// <param name="pHeight">hlbka</param>
        /// <param name="pText">text</param>
        public IFileExplorer_ProgressForm_Search(int pWidth, int pHeight, string pCurrentPath, string pOppositeCurrentPath) : base()
        {
            WaitForTerminate = new IThrSafeVariable();
            WaitForTerminate.BoolValue = false; // Inicializacia
            RunState = new IThrSafeVariable();
            RunState.IntValue = 0;
            FCurrentPath = pCurrentPath; FOppositeCurrentPath = pOppositeCurrentPath; // Ulozim vstup
            SearchData = new ISearchDataStruct(); 
            FUpdateWatch = new System.Diagnostics.Stopwatch();
            FCurrentItemName = "";
            FResultFilesCount = FResultDirsCount = FScannedCount = 0;
            VirtualList = new INodeList_VirtualItems(FCurrentPath, true); VirtualList.ListDescription = lang.FORM_SEARCH_TEXT_25;
            ExtFilter = new INodeFilters();

            Width = pWidth; Height = pHeight; // Ulozim rozmery

            FGrp = new IGroupBox(); //FGrp.Text = " " + lang.FORM_SEARCH_TEXT_2 + " ";
            FGrp.BackColor = FBackColor; 
            IControl.PlaceControl_Inside(FGrp, this, 10, 10, 10, 60);

            FLabel1 = new ILabel(lang.FORM_SEARCH_TEXT_3);
            FText_SearchPath = new ITextBox();
            FBtn_MoreSearchPath = new IButton(lang.FORM_SEARCH_TEXT_4, Event_BtnMoreSearchPathsClick, false); FBtn_MoreSearchPath.BackColor = System.Drawing.SystemColors.ButtonFace;
            FLabel2 = new ILabel(lang.FORM_SEARCH_TEXT_7); FLabel2.Font = new System.Drawing.Font(FLabel2.Font, System.Drawing.FontStyle.Bold);
            FText_SearchName = new ITextBox();
            FBtn_Filter = new IButton(lang.FORM_SEARCH_TEXT_8, Event_BtnClick_Filter, false); FBtn_Filter.BackColor = System.Drawing.SystemColors.ButtonFace;
            FCheck_SearchPartialName = new ICheckBox(lang.FORM_SEARCH_TEXT_9, true);
            FCheck_SearchInArchives = new ICheckBox(lang.FORM_SEARCH_TEXT_10, true);
            FCombo_SubdirSearch = new IComboBox(); FCombo_SubdirSearch.AddMultiItems(lang.FORM_SEARCH_TEXT_11, '\b', new int[] { -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
            FLine1 = new IHorizontalSplitLine();
            FCheck_SearchInContent = new ICheckBox(lang.FORM_SEARCH_TEXT_12); 
            FText_SearchContentValue = new ITextBox();
            FCheck_CaseSensitive = new ICheckBox(lang.FORM_SEARCH_TEXT_13);
            FCheck_HEXData = new ICheckBox(lang.FORM_SEARCH_TEXT_14);
            FCombo_ContentEncoding = new IComboBox(); FCombo_ContentEncoding.AddMultiItems(lang.FORM_SEARCH_TEXT_18, '\b', new int[] { 0, 1, 2 });
            FCheck_NotInContent = new ICheckBox(lang.FORM_SEARCH_TEXT_15);
            FLine2 = new IHorizontalSplitLine();
            FStatus = new ILabel(); FStatus.AutoSize = false;
            FResultList = new IListView(); FResultList.MultiSelect = false; FResultList.FullRowSelect = true; FResultList.HideSelection = false; FResultList.SmallImageList = IApp.App.AppSmallImageList; FResultList.ShowItemToolTips = true;
            FResultList.CreateColumn(lang.FORM_SEARCH_TEXT_16_1, 100, System.Windows.Forms.HorizontalAlignment.Right);
            FResultList.CreateColumn(lang.FORM_SEARCH_TEXT_16_2, FGrp.ClientSize.Width - 150, System.Windows.Forms.HorizontalAlignment.Left);

            FMenu_MoreSearchPath = new System.Windows.Forms.ContextMenuStrip();
            IToolStrip.CreateMenuItem(FMenu_MoreSearchPath.Items, lang.FORM_SEARCH_TEXT_5_1, Event_MenuItemClick_AddOppositePath);
            IToolStrip.CreateMenuItem(FMenu_MoreSearchPath.Items, lang.FORM_SEARCH_TEXT_5_2, Event_MenuItemClick_AddLocalDevices);
            IToolStrip.CreateMenuItem(FMenu_MoreSearchPath.Items, lang.FORM_SEARCH_TEXT_5_3, Event_MenuItemClick_ChoosePath);

            FGrp.Controls.AddRange(new System.Windows.Forms.Control[] { FText_SearchName, FCheck_SearchInContent, FText_SearchContentValue, FCheck_CaseSensitive, FCheck_NotInContent, FCheck_HEXData, FCombo_ContentEncoding, FText_SearchPath, FBtn_MoreSearchPath, FBtn_Filter, FCheck_SearchPartialName, FCheck_SearchInArchives, FCombo_SubdirSearch, FResultList });
            FGrp.Controls.AddRange(new System.Windows.Forms.Control[] { FLabel1, FLabel2, FLine1, FLine2, FStatus });
            IControl.PlaceControl_Inside_LeftTop_LeftTop(FLabel1, FGrp, 10, 26);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FText_SearchPath, FLabel1, 0, 6, FGrp.ClientSize.Width - 30 - FBtn_MoreSearchPath.Width);
            IControl.PlaceControl_Outside_LeftTop_TopRight(FBtn_MoreSearchPath, FText_SearchPath, -1, 10, -1, FText_SearchPath.Height + 3);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FLabel2, FText_SearchPath, 0, 10);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FText_SearchName, FLabel2, 0, 6, FGrp.ClientSize.Width - 30 - FBtn_Filter.Width);
            IControl.PlaceControl_Outside_LeftTop_TopRight(FBtn_Filter, FText_SearchName, -1, 10, -1, FText_SearchPath.Height + 3);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FCheck_SearchPartialName, FText_SearchName, 0, 10);
            IControl.PlaceControl_Outside_LeftTop_TopRight(FCheck_SearchInArchives, FCheck_SearchPartialName, 0, 20);
            IControl.PlaceControl_Outside_LeftTop_TopRight(FCombo_SubdirSearch, FCheck_SearchInArchives, -2, 10, FGrp.ClientSize.Width - 20 - FCheck_SearchInArchives.Right);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FLine1, FCheck_SearchPartialName, 0, 10, FGrp.ClientSize.Width - 20);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FCheck_SearchInContent, FLine1, 0, 10);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FText_SearchContentValue, FCheck_SearchInContent, 0, 6, FGrp.ClientSize.Width - 20);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FCheck_CaseSensitive, FText_SearchContentValue, 0, 10);
            IControl.PlaceControl_Outside_LeftTop_TopRight(FCheck_NotInContent, FCheck_CaseSensitive, 0, 20);
            IControl.PlaceControl_Outside_LeftTop_TopRight(FCheck_HEXData, FCheck_NotInContent, 0, 20);
            IControl.PlaceControl_Outside_LeftTop_TopRight(FCombo_ContentEncoding, FCheck_HEXData, -2, 10, FGrp.ClientSize.Width - 20 - FCheck_HEXData.Right);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FLine2, FCheck_CaseSensitive, 0, 10, FGrp.ClientSize.Width - 20);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FResultList, FLine2, 0, 10, FGrp.ClientSize.Width - 20, FGrp.ClientSize.Height - 20 - FStatus.Height - FLine2.Bottom);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FStatus, FResultList, 0, 6, FResultList.Width);

            FBtn_Cancel = new IButton(lang.FORM_SEARCH_TEXT_1, Event_BtnCancelClick); // Vytvorim tlacidla
            FBtn_Search = new IButton(lang.FORM_SEARCH_TEXT_17, Event_BtnClick_Search);
            FBtn_View = new IButton(lang.FORM_SEARCH_TEXT_23, Event_BtnClick_View);
            FBtn_FeedToList = new IButton(lang.FORM_SEARCH_TEXT_24, Event_BtnClick_FeedToList);
            Controls.AddRange(new System.Windows.Forms.Control[] { FGrp, FBtn_Cancel, FBtn_Search, FBtn_View, FBtn_FeedToList });
            IControl.PlaceControl_Outside_TopRight_RightBottom(FBtn_Cancel, FGrp, 0, 10);
            IControl.PlaceControl_Outside_TopRight_LeftTop(FBtn_Search, FBtn_Cancel, 0, 10);
            IControl.PlaceControl_Outside_LeftTop_LeftBottom(FBtn_View, FGrp, 0, 10);
            IControl.PlaceControl_Outside_LeftTop_TopRight(FBtn_FeedToList, FBtn_View, 0, 10);

            Height = FBtn_Cancel.Bottom + 10;

            KeyDown += Event_KeyDown;
            FGrp.KeyDown += Event_KeyDown;
            FBtn_Cancel.KeyDown += Event_KeyDown;
            FBtn_Search.KeyDown += Event_KeyDown;
            FText_SearchPath.KeyDown += Event_KeyDown2;
            FBtn_MoreSearchPath.KeyDown += Event_KeyDown;
            FText_SearchName.KeyDown += Event_KeyDown2;
            FBtn_Filter.KeyDown += Event_KeyDown;
            FCheck_SearchPartialName.KeyDown += Event_KeyDown;
            FCheck_SearchInArchives.KeyDown += Event_KeyDown;
            FCombo_SubdirSearch.KeyDown += Event_KeyDown;
            FCheck_SearchInContent.KeyDown += Event_KeyDown;
            FText_SearchContentValue.KeyDown += Event_KeyDown2;
            FCheck_CaseSensitive.KeyDown += Event_KeyDown;
            FCheck_HEXData.KeyDown += Event_KeyDown;
            FCombo_ContentEncoding.KeyDown += Event_KeyDown;
            FCheck_NotInContent.KeyDown += Event_KeyDown;
            FResultList.KeyDown += Event_KeyDown;

            FCheck_SearchInContent.CheckedChanged += Event_CheckedChanged;
            FCheck_HEXData.CheckedChanged += Event_CheckedChanged;
            FResultList.ItemActivate += Event_ItemActivate;
            FResultList.SelectedIndexChanged += (s, e) =>
            {
                UpdateViewButton();
            };

            // Nastavim prednastavene hodnoty
            if (pCurrentPath != "") AppendPath(pCurrentPath);
            else
            {
                if (pOppositeCurrentPath != "") AppendPath(pOppositeCurrentPath);
                else AppendPath(IFileSystem.GetSpecialPath(IFileSystem.SPECIAL_PATH_ID_WINDOWS));
            }

            FCheck_SearchPartialName.Checked = true;
            FCombo_SubdirSearch.SelectedIntID = -1;
            FCombo_ContentEncoding.SelectedIntID = 0;

            DeserializeFormContent(IApp.GlobalData.FileExplorer_SearchSettings);
            UpdateForm(); // Aktualizujem stav
        }

        /// <summary>Aktivacia panela</summary>
        public override void ActivatePanel()
        {
            FText_SearchName.Focus();
        }

        /// <summary>Pripojenie cesty</summary>
        /// <param name="pValue">hodnota</param>
        protected void AppendPath(string pValue)
        {
            if (!INodeList.IsSearchablePath(pValue)) return; // Nie je to cesta pre hladanie?

            string[] CurrPaths = FText_SearchPath.Text.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            System.Collections.Generic.List<string> L = new System.Collections.Generic.List<string>();

            bool Found = false;
            foreach (string S in CurrPaths) // Prehladavam aktualne cesty
            {
                if (!INodeList.IsSearchablePath(S)) continue; // Nie je to platna cesta?
                if (string.Compare(S, pValue, true) == 0) Found = true; // Zhoda?
                L.Add(S); // Zaradim
            }
            if (!Found) L.Add(pValue); // Zaradim aj vstup, ak tam este nie je

            System.Text.StringBuilder B = new System.Text.StringBuilder();
            foreach (string S in L)
            {
                B.AppendFormat("{0};", S);
            }
            if (B.Length > 0) B.Length--; // Zmazem posledny oddelovac
            FText_SearchPath.Text = B.ToString();
        }
        /// <summary>Aktualizacia stavu formulara</summary>
        protected void UpdateForm()
        {
            FText_SearchPath.Enabled = true;
            FBtn_MoreSearchPath.Enabled = true;
            FText_SearchName.Enabled = true;
            FBtn_Filter.Enabled = true;
            FCheck_SearchPartialName.Enabled = true;
            FCheck_SearchInArchives.Enabled = true;
            FCombo_SubdirSearch.Enabled = true;
            FCheck_SearchInContent.Enabled = true;
            FText_SearchContentValue.Enabled = true;
            FCheck_CaseSensitive.Enabled = true;
            FCheck_HEXData.Enabled = true;
            FCombo_ContentEncoding.Enabled = true;
            FCheck_NotInContent.Enabled = true;

            switch (RunState.IntValue)
            {
                case 1:
                    {
                        FText_SearchPath.Enabled = false;
                        FBtn_MoreSearchPath.Enabled = false;
                        FText_SearchName.Enabled = false;
                        FBtn_Filter.Enabled = false;
                        FCheck_SearchPartialName.Enabled = false;
                        FCheck_SearchInArchives.Enabled = false;
                        FCombo_SubdirSearch.Enabled = false;
                        FCheck_SearchInContent.Enabled = false;
                        FText_SearchContentValue.Enabled = false;
                        FCheck_CaseSensitive.Enabled = false;
                        FCheck_HEXData.Enabled = false;
                        FCombo_ContentEncoding.Enabled = false;
                        FCheck_NotInContent.Enabled = false;
                    } break;
                default:
                    {
                        bool B = !FCheck_HEXData.Checked;
                        FCombo_ContentEncoding.Enabled = B;
                        B = FCheck_SearchInContent.Checked;
                        FCheck_CaseSensitive.Enabled = B;
                        FCheck_HEXData.Enabled = B;
                        FCombo_ContentEncoding.Enabled &= B;
                        FCheck_NotInContent.Enabled = B;
                        FText_SearchContentValue.Enabled = B;
                    } break;
            }
            UpdateViewButton();
        }
        /// <summary>Spustenie hladania</summary>
        protected void StartSearch()
        {
            SearchData.Init();

            string[] CurrPaths = FText_SearchPath.Text.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); // Zaradim cesty
            foreach (string S in CurrPaths) // Prehladavam aktualne cesty
            {
                if (!INodeList.IsSearchablePath(S)) continue; // Nie je to platna cesta?
                SearchData.SearchPaths.Add(S); // Zaradim
            }
            SearchData.SearchInArchive = FCheck_SearchInArchives.Checked;
            SearchData.SearchPartialName = FCheck_SearchPartialName.Checked;
            if (SearchData.SearchPartialName)
            {
                string S = FText_SearchName.Text.Trim();
                if ((S.IndexOf('*') == -1) && (S.IndexOf('?') == -1)) SearchData.SearchNameValue = "*" + S + "*";
                else SearchData.SearchNameValue = S;
            }
            else SearchData.SearchNameValue = FText_SearchName.Text.Trim();
            SearchData.SearchMaxDepth = FCombo_SubdirSearch.SelectedIntID;
            SearchData.SearchExtFilter.Assign(ExtFilter);

            SearchData.SearchInContent = FCheck_SearchInContent.Checked;
            SearchData.SearchContentValue = FText_SearchContentValue.Text.Trim();
            SearchData.SearchInContent_CaseSensitive = FCheck_CaseSensitive.Checked;
            SearchData.SearchInContent_NotInContent = FCheck_NotInContent.Checked;
            SearchData.SearchInContent_EncodingType = FCheck_HEXData.Checked ? -1 : FCombo_ContentEncoding.SelectedIntID;
            
            if (SearchData.SearchInContent_EncodingType == -1)
            {
                if (!ISearchDataStruct.IsValidHEXSearchString(SearchData.SearchContentValue))
                {
                    IApp.ShowError(lang.FORM_SEARCH_TEXT_22);
                    FText_SearchContentValue.Focus();
                    return;
                }
            }

            VirtualList.Clear();
            FArchiveItemsCount = 0;
            FCanCancelSearchCounter = 0;
            FResultList.Items.Clear(); // Vymazem obsah zoznamu
            FResultFilesCount = FResultDirsCount = FScannedCount = 0;
            FBtn_Search.Text = lang.FORM_SEARCH_TEXT_17_1;
            FBtn_Search.Focus();
            RunState.IntValue = 1;
            UpdateForm(); // Aktualizujem formular
        }
        /// <summary></summary>
        public void StopSearch()
        {
            if (InvokeRequired) // Je treba invoke?
            {
                Invoke(new Delegate_StopSearch(StopSearch));
                return;
            }

            FStatus.Text = string.Format(lang.FORM_SEARCH_TEXT_19, FResultFilesCount, FResultDirsCount, FScannedCount);
            FBtn_Search.Text = lang.FORM_SEARCH_TEXT_17;
            RunState.IntValue = 0;
            VirtualList.CompleteList();
            UpdateForm();
        }
        /// <summary>Aktualizacia stavu tlacidla 'View'</summary>
        protected void UpdateViewButton()
        {
            if (RunState.IntValue != 0)
            {
                FBtn_View.Enabled = false;
                FBtn_FeedToList.Enabled = false;
            }
            else
            {
                int I = FResultList.SelectedIndex;
                FBtn_View.Enabled = (I != -1) && (FResultList.Items[FResultList.SelectedIndex].ImageIndex != 0);
                FBtn_FeedToList.Enabled = (FResultList.Items.Count > 0) && (FArchiveItemsCount == 0);
            }
        }

        /// <summary>Oznamenie o zacati testu objektu</summary>
        /// <param name="pName">nazov</param>
        public void SetCurrentSearchItem(string pName)
        {
            FCurrentItemName = pName;
            FScannedCount++;
            UpdateProgress(false);
        }
        /// <summary>Aktualizacia priebehu</summary>
        /// <param name="pForce">priznak okamzitej aktualizacie</param>
        public void UpdateProgress(bool pForce)
        {
            if (InvokeRequired)
            {
                if ((pForce) || (!FUpdateWatch.IsRunning) || (FUpdateWatch.ElapsedMilliseconds > 100))
                {
                    Invoke(new Delegate_UpdateProgress(UpdateProgress), new object[] { true });
                }
                return;
            }
            string S = FCurrentItemName.Length > 80 ? FCurrentItemName.Substring(0, 38) + "..." + FCurrentItemName.Substring(FCurrentItemName.Length - 38) : FCurrentItemName;
            FStatus.Text = S;
            FUpdateWatch.Reset(); FUpdateWatch.Start();
        }
        /// <summary>Zaradenie vysledku</summary>
        /// <param name="pName">nazov</param>
        /// <param name="pLength">dlzka</param>
        /// <param name="pDirectory">priznak priecinku</param>
        /// <param name="pIsArchiveItem">priznak polozky z archivu</param>
        public void AddResult(string pName, long pLength, bool pDirectory, uint pAttr, DateTime pDModify, bool pIsArchiveItem, int pOriginalID)
        {
            if (InvokeRequired) // Potrebne invoke?
            {
                Invoke(new Delegate_AddResult(AddResult), new object[] { pName, pLength, pDirectory, pAttr, pDModify, pIsArchiveItem, pOriginalID });
                return;
            }

            if (pDirectory) FResultDirsCount++; else FResultFilesCount++;

            if (FResultDirsCount + FResultFilesCount > 1000) return; // Nebudem do Listview pridavat nad 1000 poloziek

            IListViewItem I = FResultList.CreateListViewItem(); // Vytvorim zaznam
            I.Text = pDirectory ? lang.FORM_SEARCH_TEXT_20 : ICore.Size2String((ulong)pLength, 1);
            I.SubItems[1].Text = pName; I.ToolTipText = pName;
            I.ImageIndex = pDirectory ? 0 : 1;

            FResultList.Items.Add(I);
            if (pIsArchiveItem) FArchiveItemsCount++;
            VirtualList.AddNewNode(pOriginalID, IFileSystem.ExtractName(pName), pLength, pAttr, pDModify, pName);
        }

        /// <summary>Event: KeyDown</summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Event_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == System.Windows.Forms.Keys.Escape)
            {
                WaitForTerminate.BoolValue = true;
                IApp.GlobalData.FileExplorer_SearchSettings = SerializeFormContent();
                return;
            }

            // Ziskam klav. skratky pre viewer
            System.Windows.Forms.Keys K1 = IApp.CMD.GetShortcutAsKeys(ICmd.CMD_ID_FILE_EXPLORER_RUN_INTERNAL_VIEWER, false);
            System.Windows.Forms.Keys K2 = IApp.CMD.GetShortcutAsKeys(ICmd.CMD_ID_FILE_EXPLORER_RUN_INTERNAL_VIEWER, true);

            if ((RunState.IntValue == 0) && (sender == (object)FResultList) && (((e.KeyCode | e.Modifiers) == K1) || ((e.KeyCode | e.Modifiers) == K2)))
            {
                if (FResultList.SelectedIndex != -1)
                {
                    string FN = FResultList.Items[FResultList.SelectedIndex].SubItems[1].Text;
                    IApp.ShowInternalViewer(FN);
                }
            }
        }
        /// <summary>Event: KeyDown cislo 2</summary>
        /// <param name="sender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_KeyDown2(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == System.Windows.Forms.Keys.Escape)
            {
                WaitForTerminate.BoolValue = true;
                return;
            }
            if (e.KeyCode == System.Windows.Forms.Keys.Enter)
            {
                StartSearch();
                return;
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.T) && ((e.Modifiers & System.Windows.Forms.Keys.Alt) != 0))
            {
                FCheck_SearchInContent.Checked = !FCheck_SearchInContent.Checked;
                if (FCheck_SearchInContent.Checked) FText_SearchContentValue.Focus();
                else FText_SearchName.Focus();
            }
        }
        /// <summary>Event: OnClick pre tlacidlo cancel</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_BtnCancelClick(object pSender, EventArgs e)
        {
            WaitForTerminate.BoolValue = true;
            IApp.GlobalData.FileExplorer_SearchSettings = SerializeFormContent();
        }
        /// <summary>Event: OnClick pre tlacidlo FText_SearchPath</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_BtnMoreSearchPathsClick(object pSender, EventArgs e)
        {
            FMenu_MoreSearchPath.Show(MousePosition);
        }

        /// <summary>Event: Click na polozku menu</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_MenuItemClick_AddOppositePath(object pSender, EventArgs e)
        {
            AppendPath(FOppositeCurrentPath);
        }
        /// <summary>Event: Click na polozku menu</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_MenuItemClick_AddLocalDevices(object pSender, EventArgs e)
        {
            System.Collections.Generic.List<string> L = INodeList_ROOT.GetRootPathOfLocalDefices();
            foreach (string S in L)
            {
                AppendPath(S);
            }
        }
        /// <summary>Event: Click na polozku menu</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_MenuItemClick_ChoosePath(object pSender, EventArgs e)
        {
            string P = IApp.ShowEditor_ChooseDirectory(lang.FORM_SEARCH_TEXT_6, "");
            if (!string.IsNullOrEmpty(P)) AppendPath(P);
        }
        /// <summary>Event: CheckedChanged</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_CheckedChanged(object pSender, EventArgs e)
        {
            UpdateForm();
        }
        /// <summary>Event: Click na tlacidlo 'Hladaj'</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_BtnClick_Search(object pSender, EventArgs e)
        {
            if (RunState.IntValue == 0) // Nebezi hladanie?
            {
                StartSearch();
                return;
            }
            RunState.IntValue = 2; // Nastavim cakanie na zastavenie hladania
        }
        /// <summary>Event: Click na tlacidlo 'Filter'</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_BtnClick_Filter(object pSender, EventArgs e)
        {
            ExtFilter.EditWithForm(lang.FORM_SEARCH_TEXT_21);
        }
        /// <summary>Event: ItemActivate</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_ItemActivate(object pSender, EventArgs e)
        {
            if (RunState.IntValue != 0) return; // Cakaci mod?

            SingleChoosedItem = FResultList.Items[FResultList.SelectedIndex].SubItems[1].Text;
            RunState.IntValue = 3; // Nastavim 
            IApp.GlobalData.FileExplorer_SearchSettings = SerializeFormContent();
        }
        /// <summary>Event: Click na tlacidlo 'Pozriet'</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_BtnClick_View(object pSender, EventArgs e)
        {
            IApp.ShowInternalViewer(FResultList.Items[FResultList.SelectedIndex].SubItems[1].Text);
        }
        /// <summary>Event: Click na tlacidlo 'Vytvorit zoznam'</summary>
        /// <param name="pSender">zdroj</param>
        /// <param name="e">parameter</param>
        protected void Event_BtnClick_FeedToList(object pSender, EventArgs e)
        {
            if (RunState.IntValue != 0) return; // Cakaci mod?

            RunState.IntValue = 4; // Nastavim 
            IApp.GlobalData.FileExplorer_SearchSettings = SerializeFormContent();
        }
    }
}
